package uk.co.kevinlockwood.kol.messages;

import android.content.Context;
import android.text.Html;
import android.text.Spanned;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class KoLMessageAdapter extends ArrayAdapter<KoLMessage> {
	private int size;
	public KoLMessageAdapter(Context context, int textViewResourceId, int textSize) {
		super(context, textViewResourceId);
		this.size = textSize;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		TextView v = (TextView)super.getView(position, convertView, parent);
		Spanned s = Html.fromHtml(getItem(position).toString());
		v.setText(s);
		v.setMovementMethod(LinkMovementMethodIntercept.getInstance());
		v.setTextSize(size);
		return v;
	}
}
